package main

import (
	"blog/pkg/setting"
	"blog/routers"
	"fmt"
	"log"
	"net/http"

	"github.com/gin-gonic/gin"
)

func main() {
	gin.SetMode(setting.Run_Mode)
	r := gin.Default()

	routers.InitRouter(r)

	s := &http.Server{
		Addr:         fmt.Sprintf(":%d", setting.Http_Port),
		Handler:      r,
		WriteTimeout: setting.Write_Timeout,
		ReadTimeout:  setting.Read_Timeout,
	}
	if err := s.ListenAndServe(); err != nil {
		log.Fatalln("启动服务失败")
	}
}
